﻿// Decompiled with JetBrains decompiler
// Type: MCM.Abstractions.Utils.SerializationUtils
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using Newtonsoft.Json;
using System.IO;
using System.Xml;

#nullable enable
namespace MCM.Abstractions.Utils
{
  internal static class SerializationUtils
  {
    public static T? DeserializeXml<T>(Stream xmlStream)
    {
      using (StreamReader streamReader = new StreamReader(xmlStream))
      {
        string end = streamReader.ReadToEnd();
        XmlDocument node = new XmlDocument();
        node.LoadXml(end);
        string str = JsonConvert.SerializeXmlNode((XmlNode) node);
        return str != null ? JsonConvert.DeserializeObject<T>(str) : default (T);
      }
    }
  }
}
